﻿
@{
    Layout = "";
}
<h3>降拼活动团</h3>
<div class="panel panel-default" ng-controller="SpecialTopicController" ng-class="{ 'whirl standard': isLoading}">
    <div class="panel-heading">
        <div class="form-inline ng-pristine ng-valid">
            <div class="form-group">
                <input placeholder="用户名称" class="form-control" type="text" ng-model="Keywords">
                <button type="submit" class="btn btn-labeled btn-primary" ng-click="tableParams.$params.page = 1;tableParams.reload()">
                    <span class="btn-label">
                        <em class="fa fa-search"></em>
                    </span>搜索
                </button>
            </div>
            <div class="form-group">

            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table ng-table="tableParams" class="table table-striped table-bproducted table-hover">
                @*<colgroup>
                        <col style="width: 15%" />
                        <col style="width: 20%" />
                        <col style="width: 20%" />
                        <col style="width: 15%" />
                        <col style="width: 15%" />
                        <col style="width: 15%" />
                    </colgroup>*@
                <tbody>
                    <tr ng-repeat="model in $data">
                        <td data-title="'用户id'" class="text-center">{{model.UserID}}</td>
                        <td data-title="'开团时间'" class="text-center">{{model.CreateTime}}</td>
                        <td data-title="'团结束时间'" class="text-center">{{model.EndTime}}</td>
                        <td data-title="'用户名称'" class="text-center">{{model.UserName}}</td>
                        <td data-title="'现价'" class="text-center">￥{{model.NowPrice}}</td>
                        <td data-title="'已参与人数'" class="text-center">{{model.InvolvedNum}}</td>
                        <td data-title="'状态'" class="text-center">开团成功</td>
                        <td data-title="'操作'" nowrap="nowrap" class="text-center">
                            <button type="button" ng-click="gogroupheadlist(model.GroupHeadID)" class="btn btn-sm btn-warning" title="查看成员">
                                <em class="fa fa-list"></em>
                            </button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

</div>
<script>
    App.controller('SpecialTopicController', [
    '$scope', '$resource', '$state', '$route', "$stateParams", 'ngDialog', '$http', 'ngTableParams', 'ngTableDataService', 'Notify',
    function ($scope, $resource, $state, $route, $stateParams, ngDialog, $http, ngTableParams, ngTableDataService, Notify) {
        'use strict';
        $scope.isLoading = true;
        $scope.tableParams = new ngTableParams({
            page: 1,
            count: 10,
            sorting: {
                GroupHeadID: 'desc'     // 初始化排序
            }
        }, {
            getData: function ($defer, params) {
                $scope.isLoading = true;
                var requestParams = {
                    Skip: (params.page() - 1) * params.count(),
                    Take: params.count(),
                    Keywords: $scope.Keywords,
                    DropGroupID: $stateParams.Id
                };
                debugger
                $http.post('/DropGroup/GetDropHeadList', ngTableDataService.getServerSideParams(params.orderBy().toString(), params, requestParams))
                    .success(function (data, status) {
                        params.total(data.Total);
                        $defer.resolve(data.Results);
                        $scope.isLoading = false;
                    });
            }
        });

        $scope.gogroupheadlist = function (id) {
            $state.go('app.groupmemberlist', { "Id": id });
        }



    }
    ]);
</script>